package com.tms.quartz.mail.thread;

import com.tms.domain.Tool;
import com.tms.quartz.mail.ApplicationContextProvider;
import com.tms.quartz.mail.MailService;

/**
 * 邮件发送线程
 *
 * @author ozj jackie
 * @date 2020年6月30日
 */
public class SimpleMailThread implements Runnable {

    /**
     * 获取bean
     */
    private MailService mailService = (MailService) ApplicationContextProvider.getBean(MailService.class);

    /**
     * 收件人
     */
    String to;

    /**
     * 主题
     */
    String subject;

    /**
     * 内容
     */
    String content;

    /**
     * 夹具
     */
    Tool tool;

    public SimpleMailThread(String to, String subject, String content, Tool tool) {
        this.to = to;
        this.subject = subject;
        this.content = content;
        this.tool = tool;
    }

    @Override
    public void run() {
        mailService.sendMailUseHtml(to, subject, content, tool);
    }
}
